<!DOCTYPE html>
<html lang="zh-cn">
<head>
<!--{if $isGbk}-->
<meta http-equiv="Content-Type" content="text/html; charset=GBK">
<!--{else}-->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!--{/if}-->
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<title>{$moduleLang['reg_title']}</title>
<link rel="stylesheet" href="source/plugin/tom_weixin/images/bootstrap.min.css">
<script src="source/plugin/tom_weixin/images/jquery.1.11.js"></script>
<style>
html,body,div,table,tr,td,tbody,th,span,p,h1,h2,h3,h4,h5,ul,ol,li,button,img,input,a{
margin: 0 0 0 0;
padding: 0 0 0 0;
border: none;
text-decoration: none;
list-style: none;
cursor:default;
font-size: 16px;
font-family: 'Microsoft Yahei';
outline: none;
-webkit-tap-highlight-color:rgba(255,0,0,0);
}
body{ min-width:320px; margin: 0px; padding: 0px; background-color: #F6F6F6; }
.tom_top { height: 40px; width: 100%; position: relative; margin-top: 0px; line-height: 40px; text-align: center; font-weight: 600; font-size: 18px; box-shadow: 0px 0px 8px #095be3;}
.tom_back { height: 40px; width: 40px; float: left; position: absolute; left: 0px; top: 0px; }
.tom_back a{ height: 40px; width: 40px; display: block; float: left; text-align: center; line-height: 40px; font-size: 18px; color: #FFF; background-image: url(source/plugin/tom_weixin/images/reg_back.png); background-repeat: no-repeat;}
.tom_bind{ width: 100%; padding: 10px; margin-right: auto; margin-left: auto; }
.tom_bind_zc_title{ margin-top: 5px; margin-bottom: 5px; color: #666; }
.tom_bind_zc{ margin-top: 20px; }
.tom_bind_zc span{ font-size: 18px; font-weight: 600; }
.tom_bind_zc_p{ font-size: 13px; color: #999; margin-top: 5px; text-align: center; }
.tom_bind_dl_title{ margin-top: 30px; margin-bottom: 5px; color: #666; }
.tom_bind_dl_from{}
.tom_bind_dl_from input{ margin-top: 5px; margin-bottom: 5px; }
.tom_bind_dl{ margin-top: 10px; }
.tom_bind_dl span{ font-size: 18px; font-weight: 600; }
.tom_reg{ width: 100%; padding: 10px; margin-right: auto; margin-left: auto; }
.tom_reg_dl_title{ margin-top: 30px; margin-bottom: 5px; color: #666; }
.tom_reg_dl_from{}
.tom_reg_dl_from input{ margin-top: 5px; margin-bottom: 5px; }
.tom_reg_dl{ margin-top: 10px; }
.tom_reg_dl span{ font-size: 18px; font-weight: 600; }
.tom_reg_p{ font-size: 13px; color: #999; margin-top: 5px;}
</style>
</head>
<body>
<div class="tom_top btn-primary">
	<div class="tom_back"><a href="{$backUrl}"></a></div>
    {$moduleLang['reg_title']}
</div>
<div class="tom_reg">
    <div class="tom_reg_dl_title">{$moduleLang['reg_new_username']}</div>
    <div class="tom_reg_p">{$moduleLang['reg_msg']}</div>
    <div class="tom_reg_dl_from">
        <form id="regform" onSubmit="return false;">
    	<input type="text" class="form-control" id="username" name="username" placeholder="{$moduleLang['reg_username']}">
        <input type="text" class="form-control" id="password" name="password" placeholder="{$moduleLang['reg_password']}">
        <input type="text" class="form-control" id="email" name="email" placeholder="{$moduleLang['reg_email']}">
        <input type="hidden" id="wxid" name="wxid" value="{$openid}"/>
        <input type="hidden" name="formhash" value="{$formhash}">
        <input type="hidden" name="act" value="reg">
        </form>
    </div>
    <div class="tom_reg_dl">
      <button type="button" onClick="reg();" class="btn btn-success btn-block"><span>{$moduleLang['reg_btn']}</span></button>
    </div>
</div>
<script type="text/javascript">
var regProcess = 0;
function reg(){
    if(regProcess == 1){
        return false;
    }
    regProcess = 1;
    var username = $('#username').val();
    var password = $('#password').val();
    var email = $('#email').val();
    if(username == ''){
        alert("{$moduleLang['reg_must_username']}");
        return false;
    }
    if(password == ''){
        alert("{$moduleLang['reg_must_password']}");
        return false;
    }
    if(email == ''){
        alert("{$moduleLang['reg_must_email']}");
        return false;
    }
    $.ajax({
        type: "GET",
        url: "{$regUrl}",
        data: $('#regform').serialize(),
        error : function(){
            alert("{$moduleLang['reg_error']}");
            document.location.reload(); 
            return false; 
        },
        success: function(msg){
            regProcess = 0;
            var data = eval('('+msg+')');
            if(data.status==200){
                alert("{$moduleLang['reg_success']}");
                window.location="{$backUrl}";
            }else if(data.status==201){
                alert("{$moduleLang['reg_error201']}");
            }else if(data.status==202){
                alert("{$moduleLang['reg_error202']}");
            }else if(data.status==203){
                alert("{$moduleLang['reg_error203']}");
            }else if(data.status==301){
                alert("{$moduleLang['reg_error301']}");
            }else if(data.status==302){
                alert("{$moduleLang['reg_error302']}");
            }else if(data.status==303){
                alert("{$moduleLang['reg_error303']}");
            }else if(data.status==304){
                alert("{$moduleLang['reg_error304']}");
            }else if(data.status==305){
                alert("{$moduleLang['reg_error305']}");
            }else if(data.status==306){
                alert("{$moduleLang['reg_error306']}");
            }else{
                alert("{$moduleLang['reg_error']}");
            }
        }
    });
}

</script>
</body>
</html>
